﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Models;
using BLL;

namespace ReaManagementSystem.Controllers
{
    public class HomeController : Controller
    {
        // GET: Home
        /// <summary>
        /// 首页
        /// </summary>
        /// <returns></returns>
        public ActionResult Home()
        {
            var fwxinxi= HouseManager.GetHousesselect();
            return View(fwxinxi);
        }
        /// <summary>
        /// 房屋信息添加
        /// </summary>
        /// <param name="files"></param>
        /// <returns></returns>
        public ActionResult Addition(HttpPostedFileBase files)
        {
            if (files != null)
            {
                files.SaveAs(Server.MapPath("~/UploadFile/" + files.FileName));
                Response.Write("<script>alert('上传成功！')</script>");
                ViewBag.pic = files.FileName;
            }
            return View();
        }
        [HttpPost]
        public ActionResult Addition(House house)
        {
            if (HouseManager.GetHouseAdd(house))
            {
                Response.Write("<script>alert('添加成功！！')</script>");
            }
            return View();
        }
        /// <summary>
        /// 全部房屋信息浏览
        /// </summary>
        /// <returns></returns>
        public ActionResult BrowseAll()
        {
            return View();
        }
    }
}